package com.hyt.it.ogt.pj.data.mq;

import javax.annotation.Resource;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.hyt.it.ogt.pj.data.config.ConfigManager;
import com.hyt.it.ogt.pj.data.model.entity.kw.PushPj;

import lombok.extern.slf4j.Slf4j;

/**
 * 推送评卷数据生产者
 *
 * @author liuqi
 * @date 2022-05-31
 */
@Component
@Slf4j
public class PushPjDataProducer {

    @Resource
    private ConfigManager configManager;

    @Resource
    private RabbitTemplate rabbitTemplate;

    public void sendMessage(PushPj pushPj) {
        rabbitTemplate.convertAndSend(configManager.getDirect(), configManager.getPushPjDataRoute(), JSON.toJSONString(pushPj));
    }

}
